package io.lckgroup.modules.lck.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lckgroup.common.utils.PageUtils;
import io.lckgroup.common.utils.Query;
import io.lckgroup.modules.lck.dao.OrderDetailDao;
import io.lckgroup.modules.lck.entity.OrderDetailEntity;
import io.lckgroup.modules.lck.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("orderDetailService")
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailDao, OrderDetailEntity> implements OrderDetailService {

    @Autowired
    private OrderDetailDao orderDetailDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<OrderDetailEntity> page = this.page(
                new Query<OrderDetailEntity>().getPage(params),
                new QueryWrapper<OrderDetailEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<OrderDetailEntity> selectOrderDetail(long id) {
        return orderDetailDao.selectOrderDetail(id);
    }

    @Override
    public List<Map<String, Object>> getOrderDetailByOrderId(Integer orderMainId) {

        return orderDetailDao.getOrderDetailByOrderId(orderMainId);
    }
}